Termination w.r.t. Q of the following Term Rewriting System could be proven:

Q restricted rewrite system:
The TRS R consists of the following rules:

a__terms(N) → cons(recip(a__sqr(mark(N))), terms(s(N)))
a__sqr(0) → 0
a__sqr(s(X)) → s(add(sqr(X), dbl(X)))
a__dbl(0) → 0
a__dbl(s(X)) → s(s(dbl(X)))
a__add(0, X) → mark(X)
a__add(s(X), Y) → s(add(X, Y))
a__first(0, X) → nil
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
mark(terms(X)) → a__terms(mark(X))
mark(sqr(X)) → a__sqr(mark(X))
mark(add(X1, X2)) → a__add(mark(X1), mark(X2))
mark(dbl(X)) → a__dbl(mark(X))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(recip(X)) → recip(mark(X))
mark(s(X)) → s(X)
mark(0) → 0
mark(nil) → nil
a__terms(X) → terms(X)
a__sqr(X) → sqr(X)
a__add(X1, X2) → add(X1, X2)
a__dbl(X) → dbl(X)
a__first(X1, X2) → first(X1, X2)

Q is empty.


QTRS
  ↳ DependencyPairsProof

Q restricted rewrite system:
The TRS R consists of the following rules:

a__terms(N) → cons(recip(a__sqr(mark(N))), terms(s(N)))
a__sqr(0) → 0
a__sqr(s(X)) → s(add(sqr(X), dbl(X)))
a__dbl(0) → 0
a__dbl(s(X)) → s(s(dbl(X)))
a__add(0, X) → mark(X)
a__add(s(X), Y) → s(add(X, Y))
a__first(0, X) → nil
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
mark(terms(X)) → a__terms(mark(X))
mark(sqr(X)) → a__sqr(mark(X))
mark(add(X1, X2)) → a__add(mark(X1), mark(X2))
mark(dbl(X)) → a__dbl(mark(X))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(recip(X)) → recip(mark(X))
mark(s(X)) → s(X)
mark(0) → 0
mark(nil) → nil
a__terms(X) → terms(X)
a__sqr(X) → sqr(X)
a__add(X1, X2) → add(X1, X2)
a__dbl(X) → dbl(X)
a__first(X1, X2) → first(X1, X2)

Q is empty.

Using Dependency Pairs [1,15] we result in the following initial DP problem:
Q DP problem:
The TRS P consists of the following rules:

MARK(first(X1, X2)) → MARK(X1)
A__ADD(0, X) → MARK(X)
MARK(add(X1, X2)) → MARK(X2)
MARK(dbl(X)) → MARK(X)
MARK(cons(X1, X2)) → MARK(X1)
MARK(first(X1, X2)) → MARK(X2)
MARK(recip(X)) → MARK(X)
MARK(first(X1, X2)) → A__FIRST(mark(X1), mark(X2))
MARK(terms(X)) → MARK(X)
MARK(sqr(X)) → MARK(X)
MARK(add(X1, X2)) → MARK(X1)
A__FIRST(s(X), cons(Y, Z)) → MARK(Y)
MARK(sqr(X)) → A__SQR(mark(X))
A__TERMS(N) → MARK(N)
MARK(terms(X)) → A__TERMS(mark(X))
MARK(add(X1, X2)) → A__ADD(mark(X1), mark(X2))
MARK(dbl(X)) → A__DBL(mark(X))
A__TERMS(N) → A__SQR(mark(N))

The TRS R consists of the following rules:

a__terms(N) → cons(recip(a__sqr(mark(N))), terms(s(N)))
a__sqr(0) → 0
a__sqr(s(X)) → s(add(sqr(X), dbl(X)))
a__dbl(0) → 0
a__dbl(s(X)) → s(s(dbl(X)))
a__add(0, X) → mark(X)
a__add(s(X), Y) → s(add(X, Y))
a__first(0, X) → nil
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
mark(terms(X)) → a__terms(mark(X))
mark(sqr(X)) → a__sqr(mark(X))
mark(add(X1, X2)) → a__add(mark(X1), mark(X2))
mark(dbl(X)) → a__dbl(mark(X))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(recip(X)) → recip(mark(X))
mark(s(X)) → s(X)
mark(0) → 0
mark(nil) → nil
a__terms(X) → terms(X)
a__sqr(X) → sqr(X)
a__add(X1, X2) → add(X1, X2)
a__dbl(X) → dbl(X)
a__first(X1, X2) → first(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.

↳ QTRS
  ↳ DependencyPairsProof
QDP
      ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

MARK(first(X1, X2)) → MARK(X1)
A__ADD(0, X) → MARK(X)
MARK(add(X1, X2)) → MARK(X2)
MARK(dbl(X)) → MARK(X)
MARK(cons(X1, X2)) → MARK(X1)
MARK(first(X1, X2)) → MARK(X2)
MARK(recip(X)) → MARK(X)
MARK(first(X1, X2)) → A__FIRST(mark(X1), mark(X2))
MARK(terms(X)) → MARK(X)
MARK(sqr(X)) → MARK(X)
MARK(add(X1, X2)) → MARK(X1)
A__FIRST(s(X), cons(Y, Z)) → MARK(Y)
MARK(sqr(X)) → A__SQR(mark(X))
A__TERMS(N) → MARK(N)
MARK(terms(X)) → A__TERMS(mark(X))
MARK(add(X1, X2)) → A__ADD(mark(X1), mark(X2))
MARK(dbl(X)) → A__DBL(mark(X))
A__TERMS(N) → A__SQR(mark(N))

The TRS R consists of the following rules:

a__terms(N) → cons(recip(a__sqr(mark(N))), terms(s(N)))
a__sqr(0) → 0
a__sqr(s(X)) → s(add(sqr(X), dbl(X)))
a__dbl(0) → 0
a__dbl(s(X)) → s(s(dbl(X)))
a__add(0, X) → mark(X)
a__add(s(X), Y) → s(add(X, Y))
a__first(0, X) → nil
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
mark(terms(X)) → a__terms(mark(X))
mark(sqr(X)) → a__sqr(mark(X))
mark(add(X1, X2)) → a__add(mark(X1), mark(X2))
mark(dbl(X)) → a__dbl(mark(X))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(recip(X)) → recip(mark(X))
mark(s(X)) → s(X)
mark(0) → 0
mark(nil) → nil
a__terms(X) → terms(X)
a__sqr(X) → sqr(X)
a__add(X1, X2) → add(X1, X2)
a__dbl(X) → dbl(X)
a__first(X1, X2) → first(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 1 SCC with 3 less nodes.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
QDP
          ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

MARK(first(X1, X2)) → MARK(X1)
A__ADD(0, X) → MARK(X)
MARK(add(X1, X2)) → MARK(X2)
MARK(dbl(X)) → MARK(X)
MARK(cons(X1, X2)) → MARK(X1)
MARK(first(X1, X2)) → MARK(X2)
MARK(recip(X)) → MARK(X)
MARK(terms(X)) → MARK(X)
MARK(first(X1, X2)) → A__FIRST(mark(X1), mark(X2))
MARK(sqr(X)) → MARK(X)
MARK(add(X1, X2)) → MARK(X1)
A__FIRST(s(X), cons(Y, Z)) → MARK(Y)
A__TERMS(N) → MARK(N)
MARK(terms(X)) → A__TERMS(mark(X))
MARK(add(X1, X2)) → A__ADD(mark(X1), mark(X2))

The TRS R consists of the following rules:

a__terms(N) → cons(recip(a__sqr(mark(N))), terms(s(N)))
a__sqr(0) → 0
a__sqr(s(X)) → s(add(sqr(X), dbl(X)))
a__dbl(0) → 0
a__dbl(s(X)) → s(s(dbl(X)))
a__add(0, X) → mark(X)
a__add(s(X), Y) → s(add(X, Y))
a__first(0, X) → nil
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
mark(terms(X)) → a__terms(mark(X))
mark(sqr(X)) → a__sqr(mark(X))
mark(add(X1, X2)) → a__add(mark(X1), mark(X2))
mark(dbl(X)) → a__dbl(mark(X))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(recip(X)) → recip(mark(X))
mark(s(X)) → s(X)
mark(0) → 0
mark(nil) → nil
a__terms(X) → terms(X)
a__sqr(X) → sqr(X)
a__add(X1, X2) → add(X1, X2)
a__dbl(X) → dbl(X)
a__first(X1, X2) → first(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


MARK(add(X1, X2)) → MARK(X2)
MARK(dbl(X)) → MARK(X)
MARK(terms(X)) → MARK(X)
MARK(add(X1, X2)) → MARK(X1)
MARK(terms(X)) → A__TERMS(mark(X))
MARK(add(X1, X2)) → A__ADD(mark(X1), mark(X2))
The remaining pairs can at least be oriented weakly.

MARK(first(X1, X2)) → MARK(X1)
A__ADD(0, X) → MARK(X)
MARK(cons(X1, X2)) → MARK(X1)
MARK(first(X1, X2)) → MARK(X2)
MARK(recip(X)) → MARK(X)
MARK(first(X1, X2)) → A__FIRST(mark(X1), mark(X2))
MARK(sqr(X)) → MARK(X)
A__FIRST(s(X), cons(Y, Z)) → MARK(Y)
A__TERMS(N) → MARK(N)
Used ordering: Polynomial interpretation [25]:

POL(0) = 0   
POL(A__ADD(x1, x2)) = x2   
POL(A__FIRST(x1, x2)) = x2   
POL(A__TERMS(x1)) = x1   
POL(MARK(x1)) = x1   
POL(a__add(x1, x2)) = 1 + x1 + x2   
POL(a__dbl(x1)) = 1 + x1   
POL(a__first(x1, x2)) = x1 + x2   
POL(a__sqr(x1)) = x1   
POL(a__terms(x1)) = 1 + x1   
POL(add(x1, x2)) = 1 + x1 + x2   
POL(cons(x1, x2)) = x1   
POL(dbl(x1)) = 1 + x1   
POL(first(x1, x2)) = x1 + x2   
POL(mark(x1)) = x1   
POL(nil) = 0   
POL(recip(x1)) = x1   
POL(s(x1)) = 1   
POL(sqr(x1)) = x1   
POL(terms(x1)) = 1 + x1   

The following usable rules [17] were oriented:

mark(0) → 0
mark(nil) → nil
a__terms(X) → terms(X)
a__sqr(X) → sqr(X)
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(recip(X)) → recip(mark(X))
mark(s(X)) → s(X)
a__add(X1, X2) → add(X1, X2)
a__dbl(X) → dbl(X)
a__first(X1, X2) → first(X1, X2)
a__terms(N) → cons(recip(a__sqr(mark(N))), terms(s(N)))
a__dbl(s(X)) → s(s(dbl(X)))
a__dbl(0) → 0
a__sqr(s(X)) → s(add(sqr(X), dbl(X)))
a__sqr(0) → 0
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
a__first(0, X) → nil
a__add(s(X), Y) → s(add(X, Y))
mark(dbl(X)) → a__dbl(mark(X))
mark(add(X1, X2)) → a__add(mark(X1), mark(X2))
a__add(0, X) → mark(X)
mark(sqr(X)) → a__sqr(mark(X))
mark(terms(X)) → a__terms(mark(X))



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ QDPOrderProof
QDP
              ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

MARK(first(X1, X2)) → MARK(X1)
A__FIRST(s(X), cons(Y, Z)) → MARK(Y)
A__TERMS(N) → MARK(N)
A__ADD(0, X) → MARK(X)
MARK(first(X1, X2)) → MARK(X2)
MARK(cons(X1, X2)) → MARK(X1)
MARK(recip(X)) → MARK(X)
MARK(first(X1, X2)) → A__FIRST(mark(X1), mark(X2))
MARK(sqr(X)) → MARK(X)

The TRS R consists of the following rules:

a__terms(N) → cons(recip(a__sqr(mark(N))), terms(s(N)))
a__sqr(0) → 0
a__sqr(s(X)) → s(add(sqr(X), dbl(X)))
a__dbl(0) → 0
a__dbl(s(X)) → s(s(dbl(X)))
a__add(0, X) → mark(X)
a__add(s(X), Y) → s(add(X, Y))
a__first(0, X) → nil
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
mark(terms(X)) → a__terms(mark(X))
mark(sqr(X)) → a__sqr(mark(X))
mark(add(X1, X2)) → a__add(mark(X1), mark(X2))
mark(dbl(X)) → a__dbl(mark(X))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(recip(X)) → recip(mark(X))
mark(s(X)) → s(X)
mark(0) → 0
mark(nil) → nil
a__terms(X) → terms(X)
a__sqr(X) → sqr(X)
a__add(X1, X2) → add(X1, X2)
a__dbl(X) → dbl(X)
a__first(X1, X2) → first(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 1 SCC with 2 less nodes.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ QDPOrderProof
            ↳ QDP
              ↳ DependencyGraphProof
QDP
                  ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

MARK(first(X1, X2)) → MARK(X1)
A__FIRST(s(X), cons(Y, Z)) → MARK(Y)
MARK(cons(X1, X2)) → MARK(X1)
MARK(first(X1, X2)) → MARK(X2)
MARK(recip(X)) → MARK(X)
MARK(first(X1, X2)) → A__FIRST(mark(X1), mark(X2))
MARK(sqr(X)) → MARK(X)

The TRS R consists of the following rules:

a__terms(N) → cons(recip(a__sqr(mark(N))), terms(s(N)))
a__sqr(0) → 0
a__sqr(s(X)) → s(add(sqr(X), dbl(X)))
a__dbl(0) → 0
a__dbl(s(X)) → s(s(dbl(X)))
a__add(0, X) → mark(X)
a__add(s(X), Y) → s(add(X, Y))
a__first(0, X) → nil
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
mark(terms(X)) → a__terms(mark(X))
mark(sqr(X)) → a__sqr(mark(X))
mark(add(X1, X2)) → a__add(mark(X1), mark(X2))
mark(dbl(X)) → a__dbl(mark(X))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(recip(X)) → recip(mark(X))
mark(s(X)) → s(X)
mark(0) → 0
mark(nil) → nil
a__terms(X) → terms(X)
a__sqr(X) → sqr(X)
a__add(X1, X2) → add(X1, X2)
a__dbl(X) → dbl(X)
a__first(X1, X2) → first(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


MARK(first(X1, X2)) → MARK(X1)
A__FIRST(s(X), cons(Y, Z)) → MARK(Y)
MARK(cons(X1, X2)) → MARK(X1)
MARK(first(X1, X2)) → MARK(X2)
MARK(first(X1, X2)) → A__FIRST(mark(X1), mark(X2))
The remaining pairs can at least be oriented weakly.

MARK(recip(X)) → MARK(X)
MARK(sqr(X)) → MARK(X)
Used ordering: Polynomial interpretation [25]:

POL(0) = 1   
POL(A__FIRST(x1, x2)) = x1 + x2   
POL(MARK(x1)) = 1 + x1   
POL(a__add(x1, x2)) = x1 + x2   
POL(a__dbl(x1)) = 1   
POL(a__first(x1, x2)) = 1 + x1 + x2   
POL(a__sqr(x1)) = x1   
POL(a__terms(x1)) = 1 + x1   
POL(add(x1, x2)) = x1 + x2   
POL(cons(x1, x2)) = 1 + x1   
POL(dbl(x1)) = 1   
POL(first(x1, x2)) = 1 + x1 + x2   
POL(mark(x1)) = x1   
POL(nil) = 1   
POL(recip(x1)) = x1   
POL(s(x1)) = 1   
POL(sqr(x1)) = x1   
POL(terms(x1)) = 1 + x1   

The following usable rules [17] were oriented:

mark(0) → 0
mark(nil) → nil
a__terms(X) → terms(X)
a__sqr(X) → sqr(X)
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(recip(X)) → recip(mark(X))
mark(s(X)) → s(X)
a__add(X1, X2) → add(X1, X2)
a__dbl(X) → dbl(X)
a__first(X1, X2) → first(X1, X2)
a__terms(N) → cons(recip(a__sqr(mark(N))), terms(s(N)))
a__dbl(s(X)) → s(s(dbl(X)))
a__dbl(0) → 0
a__sqr(s(X)) → s(add(sqr(X), dbl(X)))
a__sqr(0) → 0
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
a__first(0, X) → nil
a__add(s(X), Y) → s(add(X, Y))
mark(dbl(X)) → a__dbl(mark(X))
mark(add(X1, X2)) → a__add(mark(X1), mark(X2))
a__add(0, X) → mark(X)
mark(sqr(X)) → a__sqr(mark(X))
mark(terms(X)) → a__terms(mark(X))



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ QDPOrderProof
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ QDPOrderProof
QDP
                      ↳ UsableRulesProof

Q DP problem:
The TRS P consists of the following rules:

MARK(recip(X)) → MARK(X)
MARK(sqr(X)) → MARK(X)

The TRS R consists of the following rules:

a__terms(N) → cons(recip(a__sqr(mark(N))), terms(s(N)))
a__sqr(0) → 0
a__sqr(s(X)) → s(add(sqr(X), dbl(X)))
a__dbl(0) → 0
a__dbl(s(X)) → s(s(dbl(X)))
a__add(0, X) → mark(X)
a__add(s(X), Y) → s(add(X, Y))
a__first(0, X) → nil
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
mark(terms(X)) → a__terms(mark(X))
mark(sqr(X)) → a__sqr(mark(X))
mark(add(X1, X2)) → a__add(mark(X1), mark(X2))
mark(dbl(X)) → a__dbl(mark(X))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(recip(X)) → recip(mark(X))
mark(s(X)) → s(X)
mark(0) → 0
mark(nil) → nil
a__terms(X) → terms(X)
a__sqr(X) → sqr(X)
a__add(X1, X2) → add(X1, X2)
a__dbl(X) → dbl(X)
a__first(X1, X2) → first(X1, X2)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
We can use the usable rules and reduction pair processor [15] with the Ce-compatible extension of the polynomial order that maps every function symbol to the sum of its argument. Then, we can delete all non-usable rules [17] from R.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ QDP
          ↳ QDPOrderProof
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ QDP
                  ↳ QDPOrderProof
                    ↳ QDP
                      ↳ UsableRulesProof
QDP
                          ↳ QDPSizeChangeProof

Q DP problem:
The TRS P consists of the following rules:

MARK(recip(X)) → MARK(X)
MARK(sqr(X)) → MARK(X)

R is empty.
Q is empty.
We have to consider all minimal (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs: